﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using LotteryVote.Logic.Web;
using LotteryVote.Entity;

namespace LotteryVote.Controls
{
    public partial class NavMenu : AuthorizeControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        public bool HasPermission(SystemRole role, string symbol)
        {
            return Execute(() =>
            {
                switch (symbol)
                {
                    case ">": return CurrentUser.Role > role;
                    case ">=": return CurrentUser.Role >= role;
                    case "<": return CurrentUser.Role < role;
                    case "<=": return CurrentUser.Role <= role;
                    default: return CurrentUser.Role == role;
                }
            });
        }
    }
}